{extend name="common/base" /}
{block name="nav_title"}
<a href="{:url('addAdminRole')}"  class="layui-btn layui-btn-normal layui-btn-sm rha-nav-title">增加角色</a>
{/block}
{block name="body"}
<div style="padding: 0px 10px 0px 10px;">
<table class="layui-table" lay-even="" lay-skin="nob">
    <colgroup>
        <col width="150">
        <col width="200">
        <col>
    </colgroup>
    <thead>
    <tr>
        <th>ID</th>
        <th>角色</th>
        <th width="40%">公众号权限</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    {volist name="roleArrList" id="vo"}
    <tr>
        <td>{$vo.id}</td>
        <td colspan="">{$vo.role_name}</td>
        <td>{$vo.mp_name}</td>
        <td>
            <a class="rha-bt-a" href="{:url('updateAdminRole',['id'=>$vo.id])}">编辑</a>
            <a class="rha-bt-a" onclick="deleteRole('{$vo.id}')" href="javascript:;">删除</a>

        </td>
    </tr>
    {/volist}
    </tbody>
</table>
</div>
{$page|raw}
<script>

    function deleteRole(id) {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.confirm('你确定需要删除吗？', {
                btn: ['是','不'] //按钮
            }, function(){
                $.post("{:url('deleteRole')}",{'id':id},function (res) {
                    if(res.status==1){
                        layer.alert(res.msg,function (index) {
                            window.location.reload();
                            layer.close(index);
                        })
                    }else{
                        layer.alert(res.msg)
                    }
                })
            })
        });

    }

</script>
{/block}